//
//  CaseModel.m
//  QuickCure
//
//  Created by 雪中狼 on 9/13/16.
//  Copyright © 2016 haoge. All rights reserved.
//

#import "CaseModel.h"

@implementation CaseModel
-(instancetype)initWithDict:(NSDictionary *)dict
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
+(instancetype)caseWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDict:dict];
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    
    
    [aCoder encodeObject:_time forKey:@"time"];
    
    [aCoder encodeObject:_illnessType forKey:@"illnessType"];
    
    [aCoder encodeObject:_basicType forKey:@"basicType"];
    
    [aCoder encodeObject:_illnessDescribe forKey:@"illnessDescribe"];
    
    [aCoder encodeObject:_photoImage forKey:@"photoImage"];
    
}


// 解档
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    if (self = [super init]) {
        //    @property (nonatomic,copy)NSString *time;
        //    @property (nonatomic,copy)NSString *illnessType;
        //    @property (nonatomic,copy)NSString *basicType;
        //    @property (nonatomic,copy)NSString *illnessDescribe;
        //    @property(nonatomic,weak)UIImage *photoImage;
 
        self.time = [aDecoder decodeObjectForKey:@"time"];
        
        self.illnessType = [aDecoder decodeObjectForKey:@"illnessType"];
        
        self.basicType = [aDecoder decodeObjectForKey:@"basicType"];
        
        self.illnessDescribe = [aDecoder decodeObjectForKey:@"illnessDescribe"];
        
        self.photoImage = [aDecoder decodeObjectForKey:@"photoImage"];
    }
    
    return self;
}

-(NSString *)description{
    return [NSString stringWithFormat:@"illnessType--%@,basicType--%@,illnessDescribe--%@,photoImage--%@",self.illnessType,self.basicType,self.illnessDescribe,self.photoImage];
}


@end
